﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NLBS.Data;
using NLBS.Control;
using NLBS.Entity;
using NLBS.Data.Business;

namespace NLBS.Admin.control
{
    public partial class categoryContent : BaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            checkAdmin();
            if (!IsPostBack)
            {
               Repeater1.ItemDataBound += new RepeaterItemEventHandler(Repeater1_ItemDataBound);
               Repeater1.DataSource = CategoryData.GetCategoryList();
               Repeater1.DataBind();
            }
        }

        void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Category cat = (Category)e.Item.DataItem;
                HtmlInputCheckBox hidden = (HtmlInputCheckBox)e.Item.FindControl("hidden");
                HtmlInputCheckBox locked = (HtmlInputCheckBox)e.Item.FindControl("locked");
                hidden.Checked = cat.Hidden;
                locked.Checked = cat.Locked;
            }
        }

    }
}